package com.zz.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zz.entity.Types;
import com.zz.service.TypesService;

@Controller
@RequestMapping("/admin")
public class TypesController {
    @Autowired
	private TypesService tsei;
    
    
    //查询所有  
    @RequestMapping("/typeList")
   	public String Typesquery(Model model){
    	List<Types> list = tsei.Typesquery();
    	model.addAttribute("list", list);
    	return "type_list.jsp";
    }
    
    
    //删除
    @RequestMapping("/typeDelete")
    public String Typesdel(int id) {
    	  tsei.Typesdel(id);
    	return "/type_list.jsp";
    }
    
    //查单
    @RequestMapping("/TypesqueryById")
    public String TypesqueryById(int id,Model m) {
    	Types types = tsei.TypesqueryById(id);
    	m.addAttribute("types", types);
    	return "/type_edit.jsp";
    }
    
  //修改
    @RequestMapping("/typeEdit")
    public String typesupdate(Types types ) {
    	tsei.typesupdate(types);
    	return "/type_list.jsp";
    }
}
